<template>
	<div id="container">
		<header class="largeCom-header-title">
	        <div class="largeCom-back" @click="backLastPage">
	          <div></div>
	        </div>
	        <div class="largeCom-title">长评--{{comment.subject.title}}</div>
	        <div class="largeCom-back"></div>
	    </header>
		<div class="largeCom-wrap">
        <div v-for="(item, index) in comment.reviews" class="largeCom-content">
          <h3>标题：{{item.title}}</h3>
          <div class="largeCom-content-header">
            <img :src="item.author.avatar" :alt="item.author.alt">
            <span>{{item.author.name}} </span>
            	<star :num="item.rating.value*10" class="smallCom-star"></star>
            <span>{{item.created_at}}</span>
          </div>
          <div @click="showContent(index)">
            {{item.summary}}
          </div>
          <div @click="showSummary" v-if="comment.reviews[index].contentShow">
            {{item.content}}
          </div>
          <footer>
            {{item.useful_count}}赞同
            {{item.useless_count}}反对
          </footer>
        </div>
      </div>
	</div>
</template>
<script>
import star from './star'
	export default{
		data(){
			return {
				comment:{
					title:''
				}
			}
		},
		components:{
		    star:star
	  	},
		mounted:function(){
			var id = this.$route.params.id
      		this.$http.jsonp('https://api.douban.com/v2/movie/subject/'+id+'/reviews?apikey=0b2bdeda43b5688921839c8ecb20399b&start=0&count=20&client=something&udid=dddddddddddddddddddddd').then(function (response) {
            this.comment = response.body
          })
    },
	methods:{
    	backLastPage: function () {
        	window.history.go(-1)
      	}
  	}
}
</script>
<style scoped>
#container{
	background-color: #e5e9f2;
}
.largeCom-header-title{
    display: flex;
    height: 50px;
    width: 100%;
    background-color: #e54847;
    padding: 6px;
    box-sizing: border-box;
  }
  .largeCom-back {
    width: 50px;
    position: relative;
    cursor: pointer;
  }
  .largeCom-back > div {
    position: absolute;
    top: 12px;
    left: 12px;
    height: 13px;
    width: 13px;
    border: 2px solid #fff;
    border-width: 0 0 2px 2px;
    transform: rotate(45deg);
  }
  .largeCom-title {
    flex: 1;
    color: #fff;
    text-align: center;
    line-height: 2;
    font-size: 20px;
    overflow: hidden;
  }
  .largeCom-wrap {
    padding: 10px;
  }
  .largeCom-content {
    margin-bottom: 10px;
  }
  .largeCom-content h3 {
    font-size: 16px;
    font-weight: normal;
  }
  .largeCom-content img {
    width: 48px;
    height: 48px;
    border-radius: 24px;  
    margin-right: 5px;
  }
  .largeCom-content-header {
    display: flex;
  }
  .largeCom-content-header span {
    align-self: center;
    color: #2c3e50;
    font-size: 12px;
  }
  .largeCom-content-header-rating {
    flex: 1;
    margin-left: 10px;  
  }
  .largeCom-content footer {
    text-align: right;
  }
  .largeCom-star {
    display: inline-block;
    line-height: 48px;
  }
  footer{
    color: #2c3e50;
    font-size: 12px;
  }
</style>